from django.contrib import admin
from app02.models import Book,Publish,Author,AuthorDetail
from app02.models import Emp,Emps, Dep
# Register your models here.

admin.site.register([Book,Publish,Author,AuthorDetail,Emp,Emps,Dep])


# 在下面的界面没有提示，建议开一个cmd 运行下面内容
#  D:/pythonpro/django_test/manage.py migrate   # 创建表结构#
#  D:/pythonpro/django_test/manage.py makemigrations app02  # 让 Django 知道我们在我们的模型有一些变更
#  D:/pythonpro/django_test/manage.py migrate app02   # 创建表结构


# 添加数据 需要一条条执行，主外键关系，执行有先后
# INSERT INTO app02_publish(NAME,city,email)
#  VALUES ('华山出版社', '华山', 'hs@163.com'),
#  ('明教出版社', '黑木崖', 'mj@163.com')
#
# # 先插入 authordetail 表中多数据
# INSERT INTO app02_authordetail
# (gender,tel,addr,birthday)
# VALUES (1,'13432335433','华山','1994-5-23'),
# (1,'13943454554','黑木崖','1961-8-13'),
# (0,'13878934322','黑木崖','1996-5-20')
#
# # 再将数据插入 author，这样 author 才能找到 authordetail
# INSERT INTO app02_author(NAME,age,au_detail_id)
#  VALUES ('令狐冲',25,1),
#  ('任我行',58,2),
#  ('任盈盈',23,3)


#############################################################
#添加emp 数据
# INSERT INTO `app02_emp`
# (`id`, `name`, `age`, `salary`, `dep`, `province`)
#  VALUES
# ('1', '令狐冲', '24', '6000.00', '销售部', '河南'),
# ('2', '任盈盈', '18', '8000.00', '关公部', '广东'),
# ('3', '任我行', '56', '10000.00','销售部', '广东'),
# ('4', '岳灵珊', '19', '6000.00', '关公部', '河南'),
# ('5', '小龙女', '20', '8000.00', '关公部', '河北');
# INSERT INTO `app02_dep` (`id`, `title`) VALUES
# ('1', '销售部'),('2', '关公部');
# INSERT INTO `app02_emps`
# (`id`, `name`, `age`, `salary`, `province`, `dep_id`)
# VALUES ('2', '令狐冲', '24', '8000.00', '河南', '1'),
# ('3', '任盈盈', '18', '9000.00', '广东', '2'),
# ('4', '任我行', '57', '10000.00', '广东', '1'),
# ('5', '岳灵珊', '19', '6000.00', '河南', '2'),
# ('6', '小龙女', '20', '8000.00', '河北', '2');